
package sr.codemg.controller;

import sr.codemg.entity.SrModulecfg;
import sr.codemg.vm.Base;
import sr.codemg.vm.Tables;
import sr.codemg.vm.Selects;
import sr.codemg.service.SrModulecfgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 模块配置
 **/
@Slf4j
@RestController
@RequestMapping("/srmodulecfg")
public class SrModulecfgController {

    @Autowired
    SrModulecfgService srModulecfgService;

    @GetMapping("/{id}")
    public SrModulecfg get(@PathVariable("id") String id) {
        return srModulecfgService.get(id);
    }

    @PutMapping
    public Tables list(@RequestBody Map<String, Object> params) {
        return srModulecfgService.findList(params);
    }

    @PostMapping
    public Base.Response post(@RequestBody SrModulecfg entity) {
        entity.setId(null);
        return srModulecfgService.add(entity);
    }

    @PutMapping("/edit")
    public Base.Response put(@RequestBody SrModulecfg entity) {
        return srModulecfgService.update(entity);
    }

    @DeleteMapping("/{id}")
    public Base.Response delete(@PathVariable("id") String id) {
        return srModulecfgService.delete(id);
    }

    @PostMapping("/select")
    public Selects.Response select(@RequestBody Selects.Request req) {
        return srModulecfgService.select(req);
    }
}

